package operations;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class BorrowOperatoin implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入借阅图书的名字：" );
        Scanner scan = new Scanner(System.in);
        String name = scan.nextLine();
        int currentSize = bookList.getUsedsize();
        for (int i = 0; i < currentSize; i++) {
            Book book = bookList.getPos(i);
            if(name.equals(book.getName())){
                book.setBorrowed(true);
                System.out.println("借阅图书成功！");
                return;
            }
        }
        System.out.println("没有要借阅的书籍");

    }
}
